package dst1.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import dst1.listener.DefaultEntityListener;

@Entity
@Table(name="MEMBERSHIP")
public class Membership implements Serializable{

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="ID") 
	private Long id;
	//TODO: Membership identified by Grid and UserID	
		
	@Column(name="REGISTRATION") 
	//@Temporal(TemporalType.TIMESTAMP)
	private Date registration;
	
	@Column(name="DISCOUNT") 
	private Double discount;
	
	@ManyToOne
	private Grid grid;
	
	@ManyToOne
	private User user;
	
	public Membership(){
		
	}

	public Membership(Date registration, Double discount, Grid grid,
			User user) {
		super();
		this.registration = registration;
		this.discount = discount;
		this.grid = grid;
		this.user = user;
	}

	public Long getId() {
		return id;
	}

	public Date getRegistration() {
		return registration;
	}

	public void setRegistration(Date registration) {
		this.registration = registration;
	}

	public Double getDiscount() {
		return discount;
	}

	public void setDiscount(Double discount) {
		this.discount = discount;
	}

	public Grid getGrid() {
		return grid;
	}

	public void setGrid(Grid grid) {
		this.grid = grid;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	
}
